package cn.juque.redoctopus.client.config;

import lombok.extern.slf4j.Slf4j;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.stereotype.Service;

/**
 * @author nuoka
 * @version 1.0.0
 * <li>IntelliJ IDEA</li>
 * <li>cn.juque.redoctopus.client.config</li>
 * @date 2020/9/27 0:22
 **/
@Slf4j
@Service
public class OctopusListener implements ApplicationListener<ContextRefreshedEvent> {

    /**
     * 应用启动成功的标志
     */
    public static Boolean startSuccess ;

    @Override
    public void onApplicationEvent(ContextRefreshedEvent contextRefreshedEvent) {
        if (null == contextRefreshedEvent.getApplicationContext().getParent()) {
            startSuccess = Boolean.TRUE;
            log.info("start successful, octopus start logging");
        }
    }
}
